/**
 * @Creator: eyes
 * @Date: 2019/12/23
 */
const DEV_YOU_SHU_REPORT_ID = {
    CORE_PAGES_OVERVIEW: 228,
    PAGES_PERFORMANCE_ANALYSIS: 229,
    PAGES_PERFORMANCE_RANK: 230,
    USER_FEATURE: 231,
    GAO_TU_CORE_PAGES_MONITOR: 246,
    // 核心页面监控自助配置
    SELF_CONFIG: 357,
    BIG_SCREEN_CONFIG: 355,
    HAO_KE_XING_KE_REPORT: 356,
    GAO_TU_XING_KE_REPORT: 400,
    HAOKE_SALES_REPORT: 384,
    GAO_TU_XU_BAN_SECOND: 492,
    GAO_TU_XU_BAN_FIRST: 491,


    // 直播间列表页面
    liveRoom: 578,
    // 单个直播间页面
    liveRoomDetail: 580,
    // 总览页面
    OVERALL_TREND: 658,
    // webapi页面
    WEBAPI: 660,
    // roomServer页面
    ROOMSERVER: 659,
    // 流媒体页面
    STREAMING_MEDIA: 661,


    TRANSFORM_REPORT: 537,
    GENERAL_VIEW_REPORT: 558,
    PAY_BOARD: 541,
    SHORT_PERIOD_CLASS: 559,
    WIND_CONTROL: 571,
    WINTER_STUDENT_BOARD: 572,
    REFUND_REPORT: 570,
    PROFITABLE_COURSE: 573,
    CENTER_SCORE_BOARD: 630,
    SPECIAL_CLASS_GENERAL_VIEW: 595,
    SPECIAL_CLASS_REALTIME_ATTEND: 594,
    SPECIAL_CLASS_ORDER_OFFLINE: 596,
    SPECIAL_CLASS_ORDERS: 597,
    CHUNJI_CANTRAL_XUBAN: 631,
    CHUNJI_GENERAL: 633,
    DEPART_BOARD: 632,
};

const PRODUCTION_YOU_SHU_REPORT_ID = {
    CORE_PAGES_OVERVIEW: 150,
    PAGES_PERFORMANCE_ANALYSIS: 151,
    PAGES_PERFORMANCE_RANK: 152,
    USER_FEATURE: 153,
    GAO_TU_CORE_PAGES_MONITOR: 180,
    SELF_CONFIG: 242,
    BIG_SCREEN_CONFIG: 240,
    HAO_KE_XING_KE_REPORT: 241,
    GAO_TU_XING_KE_REPORT: 373,
    HAOKE_SALES_REPORT: 343,
    GAO_TU_XU_BAN_SECOND: 492,
    GAO_TU_XU_BAN_FIRST: 491,
    PAY_BOARD: 541,


    // 直播间列表页面
    liveRoom: 578,
    // 单个直播间页面
    liveRoomDetail: 580,
    // 总览页面
    OVERALL_TREND: 658,
    // webapi页面
    WEBAPI: 660,
    // roomServer页面
    ROOMSERVER: 659,
    // 流媒体页面
    STREAMING_MEDIA: 661,


    TRANSFORM_REPORT: 537,
    GENERAL_VIEW_REPORT: 558,
    WINTER_STUDENT_BOARD: 572,
    SHORT_PERIOD_CLASS: 559,
    REFUND_REPORT: 570,
    WIND_CONTROL: 571,
    PROFITABLE_COURSE: 573,
    CENTER_SCORE_BOARD: 630,
    SPECIAL_CLASS_GENERAL_VIEW: 595,
    SPECIAL_CLASS_REALTIME_ATTEND: 594,
    SPECIAL_CLASS_ORDER_OFFLINE: 596,
    SPECIAL_CLASS_ORDERS: 597,
    CHUNJI_CANTRAL_XUBAN: 631,
    CHUNJI_GENERAL: 633,
    DEPART_BOARD: 632,
};

export const getReportsWhiteList = () => {
    if (process.env.ENV_TYPE === 'beta' || process.env.ENV_TYPE === 'www') {
        return PRODUCTION_YOU_SHU_REPORT_ID;
    }
    return DEV_YOU_SHU_REPORT_ID;
};

// 根据环境返回定制页面枚举
export const PAGE_ENUM = getReportsWhiteList();


// 续班报表 获取第几轮根据报表id
export const getReportRounds = reportId => {
    if (reportId === PAGE_ENUM.GAO_TU_XU_BAN_FIRST) {
        return 1;
    }
    if (reportId === PAGE_ENUM.GAO_TU_XU_BAN_SECOND) {
        return 2;
    }
    // 2轮报表
    return 2;
};

/**
 * 判定某报表id是否定制页面
 * @param id - number 报表id
 */
export const isYouShuReport = id => {
    const reportIds = Object.values(getReportsWhiteList());

    return reportIds.includes(id) || reportIds.includes(Number(id));
};

/**
 * 判定report是否为「核心页面概念」
 * @param id - report id
 * @returns {boolean}
 */
export const isCorePagesOverView = id => id === getReportsWhiteList().CORE_PAGES_OVERVIEW;

/**
 * 判定report是否为「页面性能分析」
 * @param id - report id
 * @returns {boolean}
 */
export const isPagesPerformanceAnalysis = id => id === getReportsWhiteList().PAGES_PERFORMANCE_ANALYSIS;

/**
 * 判定report是否为「核心性能排行」
 * @param id - report id
 * @returns {boolean}
 */
export const isPagesPerformanceRank = id => id === getReportsWhiteList().PAGES_PERFORMANCE_RANK;

/**
 * 判定report是否为「用户特征」
 * @param id - report id
 * @returns {boolean}
 */
export const isUserFeature = id => id === getReportsWhiteList().USER_FEATURE;

/**
 * 判定report是否为【高途核心页面监控】
 * @param id - report id
 * @return {boolean}
 *
 */
export const isGaoTuCorePagesMonitor = id => id === getReportsWhiteList().GAO_TU_CORE_PAGES_MONITOR;

/**
 * 判定页面id是否为【核心页面监控自助配置】
 * @param id - report id
 * @return {boolean}
 *
 */
export const isSelfConfig = id => id === getReportsWhiteList().SELF_CONFIG;

/**
 * 判定report是否为【大屏配置】
 * @param id - report id
 * @return {boolean}
 *
 */
export const isBigScreenConfig = id => id === getReportsWhiteList().BIG_SCREEN_CONFIG;

/**
 * 判定report是否为【好课行课报表】
 * @param id - report id
 * @return {boolean}
 *
 */
export const isHaoKeXingKeReport = id => id === getReportsWhiteList().HAO_KE_XING_KE_REPORT;

/**
 * 兼容老路由模式 report/info/:pid/:id
 * 判定report是否为高途行课
 * @param id - report id
 * @return {boolean}
 *
 */
export const isGaotuXingKeReport = id => id === getReportsWhiteList().GAO_TU_XING_KE_REPORT;

export const isGaotuXubanReport = id => id === getReportsWhiteList().GAO_TU_XU_BAN_SECOND
|| id === getReportsWhiteList().GAO_TU_XU_BAN_FIRST;

// 直播间
export const isLiveRoom = id => id === getReportsWhiteList().liveRoom;
// 总览看板
export const isOverallTrend = id => id === getReportsWhiteList().OVERALL_TREND;
// webapi
export const isWebapi = id => id === getReportsWhiteList().WEBAPI;
// roomserver
export const isRoomserver = id => id === getReportsWhiteList().ROOMSERVER;
// streamingMedia
export const isStreamingMedia = id => id === getReportsWhiteList().STREAMING_MEDIA;

// 支付看板
export const isPayBoard = id => id === getReportsWhiteList().PAY_BOARD;

/**
 * 判定report是否为demo
 * @param id - report id
 * @return {boolean}
 *
 */
export const isTransformReport = id => id === getReportsWhiteList().TRANSFORM_REPORT;

export const isWinterStudentReport = id => id === getReportsWhiteList().WINTER_STUDENT_BOARD;
export const isRefundReport = id => id === getReportsWhiteList().REFUND_REPORT;
export const isGeneralViewReport = id => id === getReportsWhiteList().GENERAL_VIEW_REPORT;
// 短期班行课转化
export const isShortPeriodClass = id => id === getReportsWhiteList().SHORT_PERIOD_CLASS;

// 流量风控
export const isWindControl = id => id === getReportsWhiteList().WIND_CONTROL;

// 正价课学情
export const isProfitableCourseReport = id => id === getReportsWhiteList().PROFITABLE_COURSE;
// 中心评分看板
export const isCenterScoreReport = id => id === getReportsWhiteList().CENTER_SCORE_BOARD;

// 专题课主讲老师行课数据: 4张报表
export const isSpecialClassGeneralViewReport = id => id === getReportsWhiteList().SPECIAL_CLASS_GENERAL_VIEW;
export const isSpecialClassRealTimeAttendReport = id => id === getReportsWhiteList().SPECIAL_CLASS_REALTIME_ATTEND;
export const isSpecialClassOrderOfflineReport = id => id === getReportsWhiteList().SPECIAL_CLASS_ORDER_OFFLINE;
export const isSpecialClassOrdersReport = id => id === getReportsWhiteList().SPECIAL_CLASS_ORDERS;

// 春季续班-中心续班
export const isCentralXubanReport = id => id === getReportsWhiteList().CHUNJI_CANTRAL_XUBAN;
// 春季续班-概览
export const isChunjiGeneralReport = id => id === getReportsWhiteList().CHUNJI_GENERAL;
// 春季续班-学部看板
export const isDepartBoardReport = id => id === getReportsWhiteList().DEPART_BOARD;
